package com.zqxq.common.constant;

import com.zqxq.common.enums.BeikeResultEnum;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;

import java.io.Serializable;



public class ResultBase implements Serializable {
	
	/** Comment for <code>serialVersionUID</code> */
	private static final long serialVersionUID = 6240239882943130668L;
	
	/** 成功状态 */
	private boolean isSuccess = false;
	
	/**订单号**/
	private String orderNo = "";

	/** 结果码 **/
	private BeikeResultEnum resultCode;
	
	/** 结果详细消息值 **/
	private String resultMessage = "";
	
	/** ==================================构造方法  开始============================= **/
	public ResultBase() {
		
	}
	public ResultBase(BeikeResultEnum resultCode, String resultMessage) {
		this.setResultCode(resultCode);
		this.setResultMessage(resultMessage);
		if (BeikeResultEnum.EXECUTE_SUCCESS == resultCode) {
			this.setSuccess(true);
		} else {
			this.setSuccess(false);
		}
	}
	public ResultBase(BeikeResultEnum resultCode, String resultMessage, boolean isSuccess) {
		this.setResultCode(resultCode);
		this.setResultMessage(resultMessage);
		this.isSuccess = isSuccess;
	}
	/** ==================================构造方法 结束============================= **/
	public boolean isSuccess() {
		return isSuccess;
	}
	public boolean isFailure() {
		return isSuccess == false;
	}
	public void setSuccess(boolean success) {
		this.isSuccess = success;
	}
	
	public String getOrderNo() {
		return orderNo;
	}

	public void setOrderNo(String orderNo) {
		this.orderNo = orderNo;
	}

	public BeikeResultEnum getResultCode() {
		return resultCode;
	}

	public void setResultCode(BeikeResultEnum resultCode) {
		this.resultCode = resultCode;
	}

	public String getResultMessage() {
		return resultMessage;
	}
	
	/**
	 * 同resultMessage
	 * @return
	 */
	public String getDescription() {
		return resultMessage;
	}
	
	public void setResultMessage(String resultMessage) {
		this.resultMessage = resultMessage;
	}
	@Override
	public String toString() {
		return ToStringBuilder.reflectionToString(this, ToStringStyle.SHORT_PREFIX_STYLE);
	}
}
